﻿@{
    Layout = null;
}

<section id="AddInventory">
    <div class="card">
        <div class="card-header">
            添加库存盘点
        </div>
        <div class="card-body">
            <form class="updateUserFrm" method="put" action="/Repertory/ADDEitity">
                <div class="form-group row">
                    <label for="inputEmail3" class="col-sm-2 col-form-label">单号：</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" placeholder="单号">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group col-md-4">
                        <label for="inputEmail4">经办人</label>
                        <input type="text" class="form-control" placeholder="经办人">
                    </div>
                    <div class="form-group col-md-4">
                        <label for="inputPassword4">建单日期</label>
                        <input type="date" class="form-control" >
                    </div>
                    <div class="form-group col-md-4">
                        <label for="inputPassword4">执行日期</label>
                        <input type="date" class="form-control" >
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group col-md-4">
                        <label for="inputEmail4">库房</label>
                        <div class="input-group mb-3">
                            <select class="custom-select" id="t1" name="HouseID">
                            </select>
                        </div>
                    </div>
                    <div class="form-group col-md-4">
                        <label for="inputPassword4">库区</label>
                        <div class="input-group mb-3">
                            <select class="custom-select" id="t2" name="HouseDetailID"></select>
                        </div>
                    </div>
                    <div class="form-group col-md-4">
                        <label for="inputPassword4">盘点商品</label>
                        <input type="text" class="form-control" placeholder="盘点商品">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group col-md-4">
                        <label for="inputEmail4">账面数量</label>
                        <input type="number" class="form-control" >
                    </div>
                    <div class="form-group col-md-4">
                        <label for="inputPassword4">实际数量</label>
                        <input type="number" class="form-control" >
                    </div>
                    <div class="form-group col-md-4">
                        <label for="inputPassword4">调整数量</label>
                        <input type="number" class="form-control" >
                    </div>
                </div>
                <div class="form-group row">
                    <label for="inputEmail3" class="col-sm-1 col-form-label">备注：</label>
                    <div class="col-sm-11">      
                        <textarea class="form-control" rows="3" cols="20"  placeholder="请输入....."></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary submit">添加</button>
                </div>
            </form>
        </div>
    </div>
</section>
<script>

    $("#AddInventory input[type='number']").on("change", function () {
        $(this).val($(this).val() >= 0 ? $(this).val() : 0);
    });

    $.post('/Repertory/StroeHouseList', function (res) {
        $("#t1").empty();
        $.each(res, function (index, item) {
            $("#t1").append('<option value="' + item.HouseID + '">' + item.HouseName + '</option>');
        })
    })

    $.post('/Repertory/StroeHouseListData', { id: 1 }, function (res) {
        $("#t2").empty();
        if (res.length > 0) {
            $.each(res, function (index, item) {
                $("#t2").append('<option value="' + item.ID + '">' + item.SubareaName + '</option>');
            })
        } else {
            $("#t2").append('<option>暂无数据</option>');
        }
    })

    $("#t1").on('change', function () {
        $.post('/Repertory/StroeHouseListData', { id: $("#t1").val() }, function (res) {
            $("#t2").empty();
            if (res.length > 0) {
                $.each(res, function (index, item) {
                    $("#t2").append('<option value="' + item.ID + '">' + item.SubareaName + '</option>');
                })
            } else {
                $("#t2").append('<option>暂无数据</option>');
            }
        })
    });


</script>
